package org.example.service.impl;
/*
* fzl
* */
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.example.domain.entity.ProductImg;
import org.example.mapper.ProductImgMapper;
import org.example.service.ProductImgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ProductImgServiceImpl implements ProductImgService {
    @Resource
    private ProductImgMapper imgMapper;
    @Override
    public List<ProductImg> queryImages(Integer productId) {
        QueryWrapper<ProductImg> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("item_id",productId);
        return imgMapper.selectList(queryWrapper);
    }

    @Override
    public Boolean updateImage(ProductImg img) {
        return imgMapper.updateById(img)>0;
    }

    @Override
    public Boolean deleteImage(Integer imgId) {
        return imgMapper.deleteById(imgId)>0;
    }

    @Override
    public Boolean insertImage(ProductImg img) {
        return imgMapper.insert(img)>0;
    }
}
